#!/usr/bin/env bash
#
# Summary: List cpan modules in current perl
#
# Usage: plenv list-modules
#

set -e

# Provide plenv completions
if [ "$1" = "--complete" ]; then
  exec plenv versions --bare
fi

if [ -z "$PLENV_ROOT" ]; then
  PLENV_ROOT="${HOME}/.plenv"
fi

plenv exec perl -MExtUtils::Installed -e 'print "$_$/" for grep $_ ne "Perl", ExtUtils::Installed->new(skip_cwd => 1)->modules'
